package com.xspace.android.imcommon.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;

import com.xspace.android.imcommon.utils.ImPreferences;
import com.xspace.android.xafcommon.util.AppUtils;

/**
 * 接收alarmManager的广播
 */
public class XmppConnectCheckBroad extends  BroadcastReceiver{
	@Override
	public void onReceive(Context con, Intent arg1) {
		if (!AppUtils.isConnected(con)) {
			Log.v("broad","XmppConnectCheckBroad*************网络不可用*************");
		    return;
		}
		String jid = ImPreferences.getInstance(con).getPfString(AppUtils.userName);
		if(TextUtils.isEmpty(jid)){
			Log.v("broad","XmppConnectCheckBroad************onReceive jid null*************");
			return;
		}
		Log.v("broad","XmppConnectCheckBroad*************onReceive*************");
		//启动服务
		Intent intent=new Intent(con,ClientService.class);
		intent.setPackage(con.getPackageName());
		con.startService(intent);
		}
		
	
}
